import { createSSRApp } from "vue";

import { createPinia } from "pinia";
import uviewPlus from "uview-plus";
import customDirectives from "./directives";
import TopNar from "./pages/components/topNav.vue";
import noData from "./pages/components/nodata.vue";
import piniaPluginPersist from "pinia-plugin-persist";

import noWork from "@/components/noWork/index.vue";

const pinia = createPinia();
pinia.use(piniaPluginPersist);
import App from "./App.vue";
import { removeStorageSync } from "@dcloudio/uni-h5";
export function createApp() {
  const app = createSSRApp(App);
  // app.mixin(share);
  app.component("top-nav", TopNar);
  app.component("no-Data", noData);
  app.component("noWork", noWork);
  app.use(uviewPlus);
  app.use(pinia);
  // 注册全局组件

  if (uni.getStorageSync("loginRefresh")) {
    uni.removeStorageSync("loginRefresh");
  }

  app.use(customDirectives);

  return {
    app,
  };
}
